package org.otarriinae.security.base.serialize;

import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.lang.reflect.Type;
import java.util.List;


/**
 * @author xj
 * @since 1.0
 */
public class GrantedAuthorityDeserialize implements ObjectDeserializer {


    @Override
    public List<SimpleGrantedAuthority> deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
        List<SimpleGrantedAuthority> authorities = parser.parseArray(SimpleGrantedAuthority.class);

        return authorities;
    }

    @Override
    public int getFastMatchToken() {
        return 0;
    }


}
